﻿using System;

namespace DuckFlyWithInterface
{
    /// <summary>
    /// 鸭子游泳行为的接口
    /// </summary>
    interface ISwimBehavior
    {
        public void Swim();
    }

    /// <summary>
    /// 正常游泳的实现（大多数真实鸭子）
    /// </summary>
    public class NormalSwim : ISwimBehavior
    {
        public void Swim()
        {
            Console.WriteLine("自由自在地游泳！");
        }
    }

    /// <summary>
    /// 只能漂浮的实现（如橡皮鸭）
    /// </summary>
    public class FloatOnly : ISwimBehavior
    {
        public void Swim()
        {
            Console.WriteLine("只能漂浮，不会真正游泳！");
        }
    }

    /// <summary>
    /// 沉底的实现（如石头鸭）
    /// </summary>
    public class Sink : ISwimBehavior
    {
        public void Swim()
        {
            Console.WriteLine("无法浮在水面，会沉下去！");
        }
    }

    /// <summary>
    /// 快速游泳的实现（如野鸭）
    /// </summary>
    public class FastSwim : ISwimBehavior
    {
        public void Swim()
        {
            Console.WriteLine("快速地划水前进！");
        }
    }
}
